<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>二维数组转置</title>
    <style>
        body{
            background-color: #F3EFE0;
        }
        .bot{
            color: #918E84;
            font-family:Arial, Helvetica, sans-serif;
            font-size: 24px;
            position: relative;
            right: 200px;
            float: right;
        }
    </style>
    <script>
        var arr = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]];
       var temp = [];
        for (var i = 0; i < arr[0].length; i++){ 
            temp[i] = [];
            for(var j = 0; j < arr.length; j++){
                temp[i][j] = arr[j][i];
            }
        }
        document.write("Please press F12 to enter the console to view the results.<br><br>请按F12进入控制台查看结果!");
        console.log('转置前:');
        console.log(arr);
        console.groupEnd();
        console.log('转置后:');
        console.log(temp);
        console.groupEnd();
    </script>
</head>
<body>
    <div class="bot">
        <input type="button" value="返回" onclick="location.href = '../章节目录/第三章.html'">
        <br><br><br><br><br><br><br><br>
        <h3>Please appreciate((●'◡'●))......</h3>
    </div>
</body>
</html>